-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Replace recursion in QueryRenderer.isSubquery(…)
with loop
#4025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
We have similar code in |
@mp911de of course ! i can do that |
…tion logic Signed-off-by: KNU-K <[email protected]>
…et query detection logic Signed-off-by: KNU-K <[email protected]>
… method for improved readability Signed-off-by: KNU-K <[email protected]>
@mp911de I have one question: in the |
Care to use tabs for indents instead of spaces? Other than that, the pull request looks ready for merge. |
@mp911de I reflected it! |
… JpqlQueryRenderer for improved readability Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
Signed-off-by: KNU-K <[email protected]>
…proved readability Signed-off-by: KNU-K <[email protected]>
…proved readability Signed-off-by: KNU-K <[email protected]>
…mproved readability Signed-off-by: KNU-K <[email protected]>
…lQueryRenderer for improved readability Signed-off-by: KNU-K <[email protected]>
That's the best name we were able to come up. |
Yes, I understand that ! |
QueryRenderer.isSubquery(…)
with loop
Reformat code and reorder author tags. See #4025
Signed-off-by: KNU-K <[email protected]> Closes #4025
Reformat code and reorder author tags. See #4025
Thank you for your contribution. That's merged, polished, and backported now. |
@mp911de oh! thank u |
This pull request refactors the logic for determining whether a given ParserRuleContext represents a subquery in the JpqlQueryRenderer class. The main change is a simplification and clarification of the isSubquery method's traversal logic.
Refactoring and logic simplification:
Refactored the isSubquery method to use an explicit while loop for traversing parent contexts, making the logic easier to follow and avoiding recursive calls.
The method now returns immediately when encountering a SubqueryContext, Update_statementContext, or Delete_statementContext, and only continues traversing if none of these are found.
By replacing recursion with an iterative approach, the method avoids continuously adding frames to the call stack, improving efficiency and stack safety for deeply nested contexts.